package cn.liip.demo.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.liip.demo.domain.Order;
import cn.liip.demo.mapper.OrderMapper;

@Service
public class OrderService {
	
	@Autowired
    private OrderMapper orderMapper = null;  //  注入mapper
	 /**
     * 根据id查询订单信息
     *
     * @param id
     * @return
     */
    public Order queryOrderById(Integer id) {
    	return orderMapper.queryOrderById(id);
    }

    /**
     * 查询所有订单信息
     *
     * @return
     */
    public List<Order> queryOrderAll(){
    	return orderMapper.queryOrderAll();
    }

    /**
     * 查询所有订单信息,返回List<Map>
     * @return
     */
    public List<Map<String,Object>>  queryOrders(){
    	return orderMapper.queryOrders();
    }
    
    /**
     * 新增订单
     *
     * @param Order
     */
    public void insertOrder(Order order) {
    	orderMapper.insertOrder(order);
    }
    
    /**
     * 更新订单信息
     *
     * @param Order
     */
    public void updateOrder(Order order) {
    	orderMapper.updateOrder(order);
    }

    /**
     * 根据id删除订单信息
     *
     * @param id
     */
    public void deleteOrder(String id) {
    	orderMapper.deleteOrder(id);
    }
}
